package storage

import (
	"github.com/olivere/elastic/v7"
	"yxs-mall/common/properties"
)

var ElasticClient *elastic.Client

func NewInit() {
	config := properties.ElasticConfig
	client, err := elastic.NewClient(
		elastic.SetURL(config.Url),
		elastic.SetBasicAuth(config.Username, config.Password),
		elastic.SetSniff(config.SnifferEnabled),
	)
	if err != nil {
		panic("elastic init client error!")
	}
	ElasticClient = client
}
